package com.sb.money.entities;

// Generated Dec 2, 2012 10:52:01 PM by Hibernate Tools 3.2.2.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Company generated by hbm2java
 */
@Entity
@Table(name = "company"
        , catalog = "money")
public class Company implements java.io.Serializable {

    private static final long serialVersionUID = -6864291362823162408L;
    private Long companyId;
    private LkCompanyType lkCompanyType;
    private String companyName;
    private Set<Item> itemsForItemProducer = new HashSet<Item>(0);
    private Set<Item> itemsForItemSeller = new HashSet<Item>(0);

    public Company() {
    }

    public Company(LkCompanyType lkCompanyType, String companyName) {
        this.lkCompanyType = lkCompanyType;
        this.companyName = companyName;
    }

    public Company(LkCompanyType lkCompanyType, String companyName,
            Set<Item> itemsForItemProducer, Set<Item> itemsForItemSeller) {
        this.lkCompanyType = lkCompanyType;
        this.companyName = companyName;
        this.itemsForItemProducer = itemsForItemProducer;
        this.itemsForItemSeller = itemsForItemSeller;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "COMPANY_ID", unique = true, nullable = false)
    public Long getCompanyId() {
        return this.companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "COMPANY_TYPE", nullable = false)
    public LkCompanyType getLkCompanyType() {
        return this.lkCompanyType;
    }

    public void setLkCompanyType(LkCompanyType lkCompanyType) {
        this.lkCompanyType = lkCompanyType;
    }

    @Column(name = "COMPANY_NAME", nullable = false)
    public String getCompanyName() {
        return this.companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "companyByItemProducer")
    public Set<Item> getItemsForItemProducer() {
        return this.itemsForItemProducer;
    }

    public void setItemsForItemProducer(Set<Item> itemsForItemProducer) {
        this.itemsForItemProducer = itemsForItemProducer;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "companyByItemSeller")
    public Set<Item> getItemsForItemSeller() {
        return this.itemsForItemSeller;
    }

    public void setItemsForItemSeller(Set<Item> itemsForItemSeller) {
        this.itemsForItemSeller = itemsForItemSeller;
    }

}
